home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / nihcl-30.lha / nihcl-3.0 / lib / StackProc.h < prev    next >
C/C++ Source or Header  |  1990-05-19  |  2KB  |  74 lines

  1. #ifndef STACKPROC_H
  2. #define STACKPROC_H
  3.  
  4. /*$Header: /afs/alw.nih.gov/unix/sun4_40c/usr/local/src/nihcl-3.0/share/lib/RCS/StackProc.h,v 3.0 90/05/20 00:21:31 kgorlen Rel $*/
  5.  
  6. /* StackProc.h -- Specification for Process with stack shared with main() process
  7.  
  8.     THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
  9.     "UNITED STATES GOVERNMENT WORK".  IT WAS WRITTEN AS A PART OF THE
  10.     AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE.  THIS MEANS IT
  11.     CANNOT BE COPYRIGHTED.  THIS SOFTWARE IS FREELY AVAILABLE TO THE
  12.     PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
  13.     RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.
  14.  
  15. Author:
  16.     K. E. Gorlen
  17.     Computer Systems Laboratory, DCRT
  18.     National Institutes of Health
  19.     Bethesda, MD 20892
  20.     January, 1989
  21.  
  22. Modification History:
  23.  
  24. $Log:    StackProc.h,v $
  25.  * Revision 3.0  90/05/20  00:21:31  kgorlen
  26.  * Release for 1st edition.
  27.  * 
  28. */
  29.  
  30. #ifdef sparc
  31. #include <alloca.h>
  32. #endif
  33. #include <malloc.h>
  34. #include "Process.h"
  35.  
  36. class Scheduler;
  37.  
  38. class StackProc: public Process {
  39.     DECLARE_MEMBERS(StackProc);
  40. public:
  41.     stackTy* stack_top;        // pointer to stack top -- public for MAIN_PROCESS
  42. private:
  43.     stackTy* stack_save;        // stack save area
  44.     unsigned long stack_save_size;    // size of stack save area in words
  45.  
  46.     StackProc(stackTy* bottom, int priority);    // MAIN process constructor 
  47.     void saveStack();
  48.     friend Scheduler;    // friend void Scheduler::initialize(stackTy* \*bottom\*, int \*priority*\)
  49. public:
  50.     void restoreStack(const stackTy*);    // public so MAIN_PROCESS macro can access
  51. protected:
  52.     StackProc(const char* name, stackTy* bottom, int priority =0, unsigned long size =0);
  53.     virtual void switchContext(Process*);
  54.     virtual void switchFrom(HeapProc*);
  55.     virtual void switchFrom(StackProc*);
  56.     bool FORK() {
  57.         add();        // add this process to Scheduler runlist
  58.         return (_SETJMP(env) == 0);
  59.     }
  60. #ifndef BUG_38
  61. // internal <<AT&T C++ Translator 2.00 06/30/89>> error: bus error (or something nasty like that)
  62. protected:        // storer() functions for object I/O
  63.     virtual    void storer(OIOofd&) const    { shouldNotImplement("storer"); }
  64.     virtual    void storer(OIOout&) const    { shouldNotImplement("storer"); }
  65. public:
  66.     virtual    void deepenShallowCopy()    { shouldNotImplement("deepenShallowCopy"); }
  67. #endif
  68. public:
  69.     ~StackProc();
  70.     virtual unsigned size() const;
  71. };
  72.  
  73. #endif
  74.